#ifndef __ARCH_UM_ARCH_PROC_H__
#define __ARCH_UM_ARCH_PROC_H__

#include <um.h>
#include <types.h>
#include <stub.h>

struct proc_struct;

#define RUN_AS_USER								\
	(current != NULL && current->arch.regs.is_user == 1)

struct context {
	jmp_buf switch_buf;
};

struct host_container {
	uint32_t host_pid;
	uint32_t nr_threads;
	struct stub_stack *stub_stack;
};

struct arch_proc_struct {
	int forking;
	struct host_container *host;
	struct um_pt_regs regs;
};

int user_segv (int pid, struct um_pt_regs *regs);
int start_userspace (void *stub_stack);
void userspace (struct um_pt_regs *regs);
void kill_ptraced_process (int pid, int wait_done);

#endif  /* !__ARCH_UM_ARCH_PROC_H__ */
